package com.tiankonguse.webbrowser;


import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Toast;
/*
 * 控制点击的链接
 * 指定某些链接不能访问，某些链接可以访问
 * 当然也可以打开新的activity
 * 
 **/
public class MyWebViewClient extends WebViewClient {
	
	public Context context = null;
	
	public MyWebViewClient(Context context){
		this.context = context;
	}
	
    @Override
    public boolean shouldOverrideUrlLoading(WebView view, String url) {
        if (Uri.parse(url).getHost().equals("tiankonguse.com")) {
        	//startActivity(new Intent(context,MainUI.class));
        	//Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
            //startActivity(intent);
            //return true;
            return false;
        }else{
        	Toast.makeText(this.context, "只能访问本站哦^_^", Toast.LENGTH_SHORT).show();
        	return true;
        }

    }
}